package com.ksc.storekeeper.client.mvp;

import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.impl.SchedulerImpl;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.inject.Singleton;
import com.gwtplatform.mvp.client.RootPresenter;
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
import com.gwtplatform.mvp.client.proxy.ParameterTokenFormatter;
import com.gwtplatform.mvp.client.proxy.PlaceManager;
import com.gwtplatform.mvp.client.proxy.TokenFormatter;
import com.ksc.storekeeper.client.presenter.AddUserPresenter;
import com.ksc.storekeeper.client.presenter.AddUserPresenter.AddUserProxy;
import com.ksc.storekeeper.client.presenter.ChangePasswordPresenter;
import com.ksc.storekeeper.client.presenter.ChangePasswordPresenter.ChangePasswordProxy;
import com.ksc.storekeeper.client.presenter.ChangeRolePresenter;
import com.ksc.storekeeper.client.presenter.ChangeRolePresenter.ChangeRoleProxy;
import com.ksc.storekeeper.client.presenter.MainPagePresenter;
import com.ksc.storekeeper.client.presenter.MyShowRoomPresenter;
import com.ksc.storekeeper.client.presenter.ProductDetailsPresenter;
import com.ksc.storekeeper.client.presenter.MyShowRoomPresenter.MyShowRoomProxy;
import com.ksc.storekeeper.client.presenter.MyStorePresenter;
import com.ksc.storekeeper.client.presenter.MyStorePresenter.MyStoreProxy;
import com.ksc.storekeeper.client.presenter.ProductDetailsPresenter.ProductDetailsProxy;
import com.ksc.storekeeper.client.presenter.SettingsPresenter;
import com.ksc.storekeeper.client.presenter.SettingsPresenter.SettingsPageProxy;
import com.ksc.storekeeper.client.presenter.ShowRoomItemsPresenter;
import com.ksc.storekeeper.client.presenter.ShowRoomItemsPresenter.ShowRoomItemsProxy;
import com.ksc.storekeeper.client.presenter.StoreAddItemsPresenter;
import com.ksc.storekeeper.client.presenter.StoreAddItemsPresenter.StoreAddItemsProxy;
import com.ksc.storekeeper.client.presenter.StoreItemsPresenter;
import com.ksc.storekeeper.client.presenter.StoreItemsPresenter.StoreItemsProxy;
import com.ksc.storekeeper.client.view.AddUserView;
import com.ksc.storekeeper.client.view.ChangePasswordView;
import com.ksc.storekeeper.client.view.ChangeRoleView;
import com.ksc.storekeeper.client.view.MainPageView;
import com.ksc.storekeeper.client.view.MyShowRoomView;
import com.ksc.storekeeper.client.view.MyStoreView;
import com.ksc.storekeeper.client.view.ProductDetailsView;
import com.ksc.storekeeper.client.view.SettingsView;
import com.ksc.storekeeper.client.view.ShowRoomItemsView;
import com.ksc.storekeeper.client.view.StoreAddItemsView;
import com.ksc.storekeeper.client.view.StoreItemsView;
import com.ksc.storekeeper.client.view.impl.AddUserViewImpl;
import com.ksc.storekeeper.client.view.impl.ChangePasswordViewImpl;
import com.ksc.storekeeper.client.view.impl.ChangeRoleViewImpl;
import com.ksc.storekeeper.client.view.impl.MainPageViewImpl;
import com.ksc.storekeeper.client.view.impl.MyShowRoomViewImpl;
import com.ksc.storekeeper.client.view.impl.MyStoreViewImpl;
import com.ksc.storekeeper.client.view.impl.ProductDetailsViewImpl;
import com.ksc.storekeeper.client.view.impl.SettingsViewImpl;
import com.ksc.storekeeper.client.view.impl.ShowRoomItemsViewImpl;
import com.ksc.storekeeper.client.view.impl.StoreAddItemsViewImpl;
import com.ksc.storekeeper.client.view.impl.StoreItemsViewImpl;

public class StoreKeeperModule extends AbstractPresenterModule {

	@Override
	protected void configure() {
		bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
		bind(TokenFormatter.class).to(ParameterTokenFormatter.class).in(Singleton.class);
		bind(RootPresenter.class).asEagerSingleton();
		bind(PlaceManager.class).to(StoreKeeperManager.class).in(Singleton.class);
		bind(Scheduler.class).to(SchedulerImpl.class).in(Singleton.class);

		bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.ITEMS_STORE);

		// main presenters
		bindPresenter(MainPagePresenter.class, MainPageView.class, MainPageViewImpl.class, MainPagePresenter.MainProxy.class);
		bindPresenter(MyStorePresenter.class, MyStoreView.class, MyStoreViewImpl.class, MyStoreProxy.class);
		bindPresenter(MyShowRoomPresenter.class, MyShowRoomView.class, MyShowRoomViewImpl.class, MyShowRoomProxy.class);

		// for mystore
		bindPresenter(StoreItemsPresenter.class, StoreItemsView.class, StoreItemsViewImpl.class, StoreItemsProxy.class);
		bindPresenter(StoreAddItemsPresenter.class,StoreAddItemsView.class,StoreAddItemsViewImpl.class,StoreAddItemsProxy.class);
		bindPresenter(ProductDetailsPresenter.class,ProductDetailsView.class,ProductDetailsViewImpl.class,ProductDetailsProxy.class);

		// for my showroom
		bindPresenter(ShowRoomItemsPresenter.class, ShowRoomItemsView.class, ShowRoomItemsViewImpl.class, ShowRoomItemsProxy.class);

		// for settings view
		bindPresenter(SettingsPresenter.class, SettingsView.class, SettingsViewImpl.class, SettingsPageProxy.class);
		bindPresenter(AddUserPresenter.class, AddUserView.class, AddUserViewImpl.class, AddUserProxy.class);
		bindPresenter(ChangeRolePresenter.class, ChangeRoleView.class, ChangeRoleViewImpl.class, ChangeRoleProxy.class);
		bindPresenter(ChangePasswordPresenter.class, ChangePasswordView.class, ChangePasswordViewImpl.class, ChangePasswordProxy.class);
	}
}
